The teleporter room is where people get stuck, and it took a couple of attempts to nail down. Once you're past it, the rest is easy.
Enter the hideout, go right, then up, then take the stairs. Step into the teleporter on the left.
You'll arrive in a room with water beside you and another teleporter just across it, slightly below and barely in frame. Walk all the way around the water's edge to reach it and step in.
Now you're facing three teleporters. Take them in this order: right, then middle, then left, then far left — not the middle one again. That last one is the trap that resets you.
The Master Ball is one of the four Poké Balls in the room beyond. An Escape Rope won't get you out, so retrace the steps in reverse.
Save it for the box legends — Groudon and Kyogre fall to regular and Ultra Balls more easily than Rayquaza does.