Phase transitions in two-dimensional anisotropic quantum magnets