We keep a list of triangle normals found so far. For each normal direction, we should have 2 distances from the origin (2 parallel box faces). If the mesh is a box, we should have 3 distinct normal directions, and 2 distances found for each. The difference between these distances should be the box dimensions. The 3 directions give us the key axes, and therefore the box transformation matrix. This shouldn't rely on any vertex-ordering on the triangles (normals are compared +ve & -ve). It also shouldn't matter about how many triangles make up each side (but it will take longer). We get the centre of the box from the centre of its AABB.