We derive a rigorous theory of the interaction between photons and spatially extended excitons confined in quantum dots in inhomogeneous photonic materials. We show that beyond the dipole approximation, the radiative decay rate is proportional to a nonlocal interaction function, which describes the interaction between light and spatially extended excitons. In this regime, light and matter degrees of freedom cannot be separated and a complex interplay between the nanostructured optical environment and the exciton envelope function emerges. We illustrate this by specific examples and derive a series of important analytical relations, which are useful for applying the formalism to practical problems. In the dipole limit, the decay rate is proportional to the projected local density of optical states, and we obtain the strong and weak confinement regimes as special cases.