Detect collision for non axis-aligned bounding boxes
Write two functions: (1) point in 3D box, and (2) segment intersect rectangle in 3D. Point in box is a conjunction of six left-of-plane checks. For (2), solve for the point of intersection between the line containing the segment and the plane containing the rectangle. Then check if that point is on the segment, and if so, in the rectangle.
Then box $B_1$ intersects box $B_2$ if any corner of $B_1$ is inside $B_2$, or if any of the $12$ edges of $B_1$ intersects any of the $6$ faces of $B_2$.
This can be sped up a bit by ordering the tests (for example, if no edge of $B_1$ intersects a face of $B_2$, then you need only check one corner of $B_1$ inside/outside $B_2$).