Start by checking with a long level to see if the hinge side of the frame is plumb. If ok, fasten the hinge side of the jamb to that stud and see if the door works ok. If so, fasten the latch side of the jamb using shims as necessary.
I use 6p or 8p finishing nails for this and don't drive them all the way until you have everything working right. Then set them with a nail set. You may have to trim off the bottom of the door to clear the floor covering.
This is not necessarily a simple task; try one and see how you do.