Select the free point variable at the bottom right corner of the rectangle (P_2) and add the constraint: "=slope(P_0, -1), where P_0 is the point variable at the top left of the rectangle. After pressing Enter/Return, the rectangle should turn into a square.
Save the document as square_1.svg in the Basic Shapes folder.