Transform between a cube’s surface and a square

I plan to add this transformation to my upcoming book on computational geometry. This mapping provides a one-to-one correspondence between RGB color and locations on a dance floor for a positioning correction in a project on robotic square dancers. Fun!