Thoughts I've heard around from some birders was that it might be to warm up the feathers and discourage parasites from digging in, and moving on to another location - in effect loosening them up to be more easily picked or preened away. I know the cormorants and anhingas need to dry off their feathers after a swim, but they are usually with their backs to the sun - the herons and egrets seem to perform this satellite-dish pose facing directly into the sun, and often perform cooling exercises with their gular fluttering (at least down here in the hot Florida sun!)...almost as if they're heating themselves up a little too much, and cooling themselves while doing it - which would make me think it could be a maintenance thing they feel they must occasionally do. I suppose lapping up vitamins from the sun is also feasible!