Quantum Theory from First Principles