Start with any quadrilateral and build a square outward on each side. Connect the centers of opposite squares.
The source code is at github.com/KirillOsenkov/LiveGeometry. It is written in .NET and Avalonia.