I have never had the need to do something like that but as long as you can maintain the required 1-1/4" for the cables from the face of the studs, the required conductor length in the box and the box fill I see no problem.

-Hal