In heavy transition metal oxides, electronic correlation and strong spin-orbit coupling can give rise to “hidden order”, with multipolar order parameters. Here, the authors investigate the origin of the unusual quadrupolar and magnetic phases in the double perovskite Ba2MgReO6. They derive its low-energy Hamiltonian from first principles and show that its antiferroic order of x2-y2 quadrupoles and a low-temperature canted antiferromagnetic phase emerge from the interplay between electron-lattice coupling and multipolar superexchange interactions.