Given the coordinates of four points P1, P2, P3, and P4 in 2D space, determine if these points form a square.
Each point Pi is represented as [xi, yi], and the points may be provided in any order.
A square is defined as having:
Constraints:
p1.length == p2.length == p3.length == p4.length == 2
−104≤ ...