level 5
lines = Table[{{i, Mod[i + 1, 4, 1]},
4 + {i, Mod[i + 1, 4, 1]}, {i, i + 4}}, {i, 4}]~Flatten~1~
Join~{{2, 8}, {4, 5}};
viewPoint = 10*{1.3, -2.4, 2};
pts0 = {{0, 0, 0}, {1, 0, 0}, {1, 1, 0}, {0, 1, 0}, {0, 0, 1}, {1, 0,
1}, {1, 1, 1}, {0, 1, 1}};
hiddenQ[point_, pts_] := Module[{hex = Hexahedron[pts], intersect},
intersect = RegionIntersection[Line[{point, viewPoint}], hex];
Head[intersect] === Line &&
EuclideanDistance @@ Chop@intersect[[1]] > 1*^-2]
plot[\[Theta]_] := Module[{pts, hex},
pts = RotationTransform[\[Theta], {0, 0, 1}, {1/2, 1/2, 0}][pts0];
hex = Hexahedron[pts];
Graphics3D[{If[hiddenQ[Mean[pts[[#]]], pts], Dashed, Nothing],
Thick, Line[pts[[#]]]} & /@ lines, ViewPoint -> viewPoint,
PlotRange -> {.8 {-1, 1} + 1/2, .8 {-1, 1} + 1/2, {0, 1.2}},
Boxed -> False]
]
Animate[plot[\[Theta]], {\[Theta], 0, 2 \[Pi]}]



