Layer-resolved absorption of light in arbitrarily anisotropic heterostructures