As pointed out, you can try to tweak a hinge to compensate for any sagging.
Or I have had better results by figuring out where the thing has been messed up, and getting some small flat washers, and installing them underneath the hinge plate, just enough to cause either the top or the bottom of the door to tilt the right way to re plumb it to correct.
Put these flat washers over the hinge screws in either the top or the bottom hinge, whichever will cause the door to become plumb. Loosen all the hinges on the jamb, but just remove the screws on the hinge that needs tweaked, washers then reinstall the screws, recheck for plumb. Add or get thinner washers to get it exactly plumb.