Dust emission from inhomogeneous interstellar clouds: Radiative transfer in 3D with transiently heated particles