Moved transformLayer function up.
Utility code for calculating a transformed layer's bounds.