The cube's edges are segments split into 8 equal parts. Each face is like a chessboard, 8 × 8 squares. Stretching a segment stretches each of the 8 parts proportionally.
The source code is at github.com/KirillOsenkov/LiveGeometry. It is written in .NET and Avalonia.