Rehabilitation tasks are generally subjected to the physiotherapist's qualitative interpretation of the patient's pathology and needs. Motivated by the recently increasing use of virtual reality in rehabilitation, we propose a novel approach for the design of those biomechanical tasks for an improved patient-specific and entertaining rehabilitation. During training, the subject wears 3D goggles in which virtual tasks are displayed to him. His kinematics and muscles activation are tracked in real time and an inverse model is estimated by artificial neural networks. The resulting inverse model produces a physical exercise according to the observed abilities of the subject and to the expected performance dictated by the physiotherapist. The system offers several advantages to both the patient and the physiotherapist: the tasks can be presented in the form of interactive personalized 3D games with augmented feedback, stimulating the patient's motivation and reducing the need of constant monitoring from the therapist. Additionally, offline quantitative data from every training session can be stored for further analysis. The results of our study on arm movements suggest an improvement in the training efficiency by 10% for the biceps and by 32% (p=0.02) for the triceps.