Layer > Deflate to Fit Content discards the transparent areas of a drawing layer and shrinks down its border so it only includes a rectangular region around what's been drawn. Use it to reduce the layer for easier resizing and rotation.
Note that only areas that are 100% transparent are trimmed away from the layer. So, if the layer's border appears to enclose empty space, there may be pixels that appear transparent but are just slightly opaque. Running over the edges with the Eraser tool again may help ensure that the areas you intend to erase are completely transparent.