Determine if the door is not shutting all the way (the inside edge of the door scrapes the inside door frame and the door doesn't latch) or the door is overextended and can't close (the door latch or outside door edge hits the door frame on the strike plate side).
Loosen the hinge screws on each hinge. You may choose to have another person steady the door and keep it from dropping too low when the hinge screws are loose.
Line up the hinges so they are both in a straight line. If the door was overextended, move the hinges slightly back away from the doorway. If the door was too far in toward the hinge side, move the hinges slightly toward the doorway. You may need to remove the hinge screws completely to facilitate this step.
Have your assistant hold the door in place while you fully tighten the hinge screws.
Gently swing the door back and forth and open and close it to ensure that the door is flush.