Quantum theory from quantum gravity