How to make a HyberCube (textured large cube that explodes into smaller textured cubes)?

I created (a long time ago) an OpenGL demo to create a slick animated hypercube (a cube that gets spit into 8 x 8 x 8 smaller cubes with 6 face textures. The cube starts as a simple cube with 6 separate textures and then gradually splits up into smaller cubes projecting square sub-segments of the textures onto the small cubes. This makes more sense as video.

In OpenGL I programmed this as texture map computing texture coordinates. I suspect this could be done quite elegantly in THREE.js but don’t quite see how I can make my own mesh(es) out of smaller cubes sharing different parts of cube textures. Any suggestion would be quite welcome.

So far I can only imagine a brute force solution in which I manually create the 8 x 8 x 8 = 512 cubes as individual texture cubes each with their own version of 6 textures. This just does not sound right. There must be a much simpler way in which in just provide the 6 large textures, specify the number splits (e.g., 8) and automatically compute the meshes. But how?

best, Alex