I wonder if this is correct, or if it could be made more elegant.
Types of squares:
a1-b1-b2-a2 (1,0 square. from first square to the next, one step to the right, none towards the 8th row)
..
a1-h1-h8-a8. (7,0 square)
Then there are some in a 45 degree angle.
b1-c2-b3-a2. (1,1 square).
..
d1-g4-d7-a4 (3,3 square).
And the rest.
b1-d2-c4-a3 (2,1 square)
A square with dimensions (x,y) as defined above are possible as long as x + y < 8, and fit on the board in (8 - (x+y))^2 positions. Also, due to symmetry squares (0,1) and (1,0) are the same square, but (1,2) and (2,1) are not.
Thus,
(0,1): 49
(0,2) and (1,1): 36
(0,3), (1,2), and (2,1): 25
(0,4), (1,3), (2,2) and (3,1): 16
(0,5), (1,4), (2,3), (3,2), (4,1): 9
(0,6), (1,5), (2,4), (3,3), (4,2), (5,1): 4
(0,7): 1
1x49 + 2x36 + 3x25 + 4x16 + 4x9 + 6x4 + 1x1 = 50 + 72 + 124 = 266 different quadruplets that form a square out of a total of 64! / (60!4!) = 635,376 so the probability of randomly picking a foursome that forms a square on the chessboard is about 0.04%.