Photonic Realization of the Quantum Rabi Model