Don't start with a square :)
1. Draw a point
2. Draw another point
3. Connect 1 and 2 with a Ray or a Line (doesn't matter)
4. Draw a perpendicular line to line 3 and passing through point 1
5. Select the Point tool and click anywhere on line 3 (it will create a PointOnFigure)
6. Select the Point tool and click anywhere on line 4
7. Draw a parallel line to line 3 passing through point 6
8. Draw a parallel line to line 4 passing through point 5
9. Select the Point tool and click in the intersection of line 7 and line 8
10. Ctrl+Click to select line 3, line 4, line 7, line 8
11. In the properties grid deselect the Visible checkbox to hide the auxiliary lines
12. Use the Polygon tool to connect points 1, 5, 6, and 9
If you look at the XML more closely, the algorithm is encoded right there, step by step - dependencies for a perpendicular line, for example, mean a line and a point. The Point tool is used for "free points", points on figures and intersection
points, depending on whether you click on zero figures, one figure or two figures.
Hope this helps!