Jaynes–Cummings theory out of the box