Dynamically subdivide faces in a geometry to have multi-colored faces


Using the solution from here I created a custom buffer geometry.

Right now I use a static pink texture to be rendered on every face (where the outside of this texture is transparent) and the background is orange.

My final solution ended up looking like this:

The actual problem I wanted to solve was to have multi-coloured sub-square faces in every face. In future I could have 4 colors on one face. (Right now it is 2, ie pink and orange but in future there could be a red box inside the pink one and another green box inside the red) The static texture approach will fail here as I would have to manually create these textures externally.

What other alternative could I use so that I can dynamically have multi-colored subdivided faces in every cube face here ?

Any help would be invaluable.