As far as known Motorola does not provide or sell any replacement parts for its devices. To fix your problem, it is recommended to take your device for repair. Generally these type of components are not under warranty, so it is most likely, that the service center might ask for a fee to repair it.
Apart from it, if you can get a rear camera from somewhere you can follow these steps and check out if it works. You need these following tools to work with:
a) Torx screwdriver T3, b)Spudger and 3)Tweezers
1. Remove back cover
2. Remove rear housing
3. Remove motherboard
4. Remove the adhesives underneath carefully, by peeling them off one by one.
5. Remove rear camera glass
6. Install the new rear camera glass
7. Install back the motherboard with the help of the above said tools. You have to be extra careful while peeling off the black stickers and while placing them back.
8. You have to gently take out the wires and place them back.
9. Place the rear housing back to its place.
10. Place the back cover and you are done.