Vedic hymns are mostly dedicated to Indra, Agni, and Varuna (and other gods in the Vedic pantheon) and the injunctions to use these hymns prescribed their use in fire sacrifices. Yet today these hymns are used widely outside the fire sacrifice context (as in temples) and are used to worship Ganesha, Skanda, Shiva, and other Puranic deities. I've always wondered which scriptures sanction the use of these vedic hymns outside of the originally prescribed context. What are the earliest such scriptures?
I understand this may be a sensitive question to some and may invite opinion-based answers that this stack frowns upon -- but this question has always loomed large for me, and I'm looking for "authoritative" (and ideally ancient) texts and authors who have weighed in on the matter.