Indian and Chinese origin, I cant remember which was the earliest . In Magick and in Kabbalah ( what is 'Shams' ? ) they are used for attracting planetary energies . For example on the front of the altar in the planetary 'Rites of Elusive ' .
I have tried different versions ; the standard grid showing the number arrangement , the sigil of the planetary spirit , usually some other type of sigil ( going off memory here ) and painted in corresponding 'flashing colors ' . But some I did differently ; creating a type of 'mandala' out of them .
This can be done by drawing up the square accurately and evenly ( lest say , Mercury , which is an 8 x 8 square . Now take a reference point , say the middle of each square ( or a corner of a square , less drawing up - but make sure you point each square the same ; eg right top corner , make the top right corner the 'numbered point of each square . Now draw a line in 'join the dots fashion ' from 1 to 2 to 3 and so on .... and then get a surprise ! The segments that form can then be painted in the 4 fold color scheme for Mercury .
Lower number squares are easiest to start but to form a mandala , rotate the formed pattern and superimpose over the original shape at 90 deg .
Ben Franklin's 8 x 8 square ( Mercury ) is different , it doesnt form a mandala but 'two columns - like a Gemini glyph.
For me it did not need rotation .
a mandala type with superimposed rotation and colored ;
Mine look different as I used magical 4 color scale . The one above is one of 'Jain J . Jain's - he showed me the technique 40 years ago . They would be painted on large sheets , using various media ( Paint , glitter , sewn on beads and crystals , fringes and bells on borders ) and hung up outdoors for public exhibition . Since then J went professional with it .