Are the shelves mounted in place already, or can they be slid out a little bit from the back wall?
My project last weekend was a similar issue, a cabinet with a face frame to fit tightly within the space along the back wall of a mud room. In this case, I brought the shelf (cabinet) sections together within the space and held the cabinet out from the wall enough to clamp the face frame to the back of the uprights to get the clamping pressure. Once the glue dried for the face frame, I slid the plywood (back of the cabinet) in place and shoved the whole thing back against the wall.
Of course, I did this after building a cabinet with the face frame mounted, only to find out that the entire thing was too deep to rotate into place (D'oh!). So now the first cabinet has a home in the shop instead of the mud room.