If you trim it down to just
---
numberOfSquares = 5;
p= {Sq[#, 1] & /@ #} & /@ shapes[numberOfSquares - 1]
---
then you get a list of polygons and you can look up the help page for Polygon to understand how the verticies. You might be able to learn enough to write code to translate Polygon into the form of data that you actually want.