What are the square holes for in most electronic project boxes?
These are called bosses. A boss is a post with a hole that can accept a screw. If the boss is tall in relation to the diameter, it should be reinforced with gussets (those shapes on the side that help keep the boss from snapping off at the base).  



Sometimes the posts have molded-in or ultrasonically pressed in brass inserts that provide a thread. 

Edit: Given the detailed photos the OP added, I'm thinking the square holes are intended to take square inserts, as mentioned above. I'm not 100% certain of this, as most are round with teeth around the outside. Making them square would have some advantages, but does not seem to be common outside of India (though perhaps that Chinese company is Indian owned). 

 

For low cost, thread forming screws are used. Note that they are not the same as self-tapping screws used for metal. The thread form is quite different (much skinnier with sharper flutes) to cut threads into the plastic.