Principled Probabilistic Imaging using Diffusion Models as Plug-and-Play Priors