I am working on a game program. I have an array of 8 points in 3d space $(X,Y,Z)$ that are the 8 corners of a cube whose $W=H=D$. The 8 points are listed in no particular order. For the sake of determining this algorithm, The cube's center is at the world origin, $(0,0,0)$ but the cube's orientation is not aligned with the Cartesian axis (it's arbitrarily rotated). I'd like to create 6 sets of $4$ points each that represent the faces of the cube but I'm stumped as to how to proceed
Any idea of an algorithm that would help me?