Get the layer's rectangle correctly.