Thermal rectification through a nonlinear quantum resonator