According to About.com, the function of the rectus femoris muscle is to enable knee extension and hip flexion. The rectus femoris, along with five other hip flexors, is responsible for flexion that draws the legs towards the trunk of the body.
About.com explains that the rectus femoris is attached to the pelvis on one side and the patellar tendon below the knee on the bottom side. This muscle is part of the quadriceps muscle group, which also consists of the vastus medialis, the vastus intermedius and the vastus lateralis. These muscles are all on the front side of the thigh.