Quantizing polaritons in inhomogeneous dissipative systems