A 4x8 sheet of foam or plywood is 4,608 square inches. Roughly 1 pound per square inch for a camper that weighs 4,600 pounds. If one end is heavier than another, I would imagine the foam would 'self level' as it compresses under the additional load. If excessive compression happens, add additional foam UNDER this now-customized. mold of foam that matches your truck.
I imagine that the ribs in the bed of the truck are roughly 50/50 raised to recess, making the load per square inch on the loaded foam underneath double what the load is distributed on the top.
My truck's bed is deeper toward the tail gate than it is at the cab end. Makes my camper looks squatty in the back and the clearance between the camper sides and bed rail not parallel. I ended up making a wedge to level out the camper to the bed rails for a cleaner look. It also keeps fewer bugs from smashing into the camper behind the truck's cab and I imagine the air resistance as well is reduced somewhat.