This is obviously an extreme example, but...
My BFF crashed a 4 wheeler at 45 mph when he was 16. Luckily a big pile of broken up concrete stopped him

. The crash broke his tibia, fibia, ulna, radius, elbow, humerus (all of these were compound fractures, which are the kind that poke through the skin), lost most of his kneecap (it was laying on the ground) and broke the bottom of his femur off. If the ambulance showed up 5 min. later, he would have bled to death. At the hospital that night, the docs initially said that they would likely have to amputate his left leg below the knee. Then they said he would never be able to bend it, then they said he would never get more than 10 degrees of motion, then they said he would never get more than 45.
After a extensive rehab and physical therapy, he had full mobility of his leg in less than two years. He said the most painful part of the recovery process was when the physical therapist would have to break the scar tissue away from the ligaments and muscles so that it wouldn't immobilize the joint. He also had to do a lot of reps with little to no weight to try and build up strength in his knee.
I tore 2 of the 3 tendons in my rotator cuff in 8th grade and part of my pt involved lifting soup cans. They also did deep tissue heat, which helps relax the muscles surrounding the joint. So stretching and a lot of reps with little or no weight were the keys to both of our rehabs.
Go to a physical therapist. They will be able to help figure out what kind of exercises and stretches would be most beneficial.