I suggest the following:
(1) Plot the 4 points. You will note that the 4 sides are PQ, QR, RS, and SP.
(2) Use the distance formula to calculate the lengths of the 4 sides.
L = √[(x1 - x2)2 + (y1 - y2)2],
where (x1,y1) and (x2,y2) are the end points of a side. To be a square, all 4 lengths must be equal. Are they equal?
(3) To be a rectangle or square, adjacent sides must also be perpendicular. At each end point, where adjacent sides intersect, you have 2 lines parallel to the 2 adjacent sides, intersecting at the end point. Find the slopes m and m' of the 2 lines that intersect at the end point of 2 adjacent slides.
m = (y2 - y1) / (x2 - x1)
If
mm' = -1,
the adjacent sides are perpendicular.
If you end up with 4 sides of equal length and all adjacent sides are perpendicular, then you have a square.