I think you want to "extrued" the cube face along a path?

I've done something like this in my game with a distorted cylinder that I used as a "warp" tube. Its simple, or complicated, depending on how you look at it I guess.

Make a cube with N slices. (4 corners, but more than four vertices) that is 1 x 1 x 1 unit.

Create an array of Vector3s, with as many elements as you have slices in your cube. Each point represents a point along the path that you want to extrued your cube.

Pass the array to a vertex shader. There, for each vertex, lookup where it should be placed in the path based on the vertex's Z value.

So for each vertex being processed, take the vertex while it is in its original state (before the world_view_projection multiplication). Translate the Z so that you have no negative Z values. Multiply the vertex's Z by the size of the array and that is the index of the array of path positions for that vertex. Add the Vector3 in that array to the vertex.

Now, if you want the faces to follow the curve, that is, stay perpendicular to the path as they mover around it, you'll need to look at each position and the one behind it in the array, get the change in direction, create a rotation matrix, and rotate the vertex accordingly.

Once you do all that with the raw vertex, then process it as you normally would (i.e., do your world & world view projection transforms).

Best,

Byron