shadowed*rectangle: Don't use base class result if materials are different
When comparing two materials, if we have already concluded that the materials are different, don't return the result of the base class' compare as that result may actually indicate that the materials are the same, which will lead to the materials being batched when they shouldn't.
(cherry picked from commit c900ea00)