Fix MBS detection for rotated structures (90 and 270 degrees)