You aren't showing the code where you call the compileShader() function.

The number of squares should be irrelevant because you shouldn't be compiling the shader more than once.