A renormalized perturbation theory for problems with non-trivial boundary conditions or backgrounds in two space–time dimensions