@Jereme asked about this.
Here is Venerable Ru De talking about this topic (Starting from the 1min 50s mark):
若有法寶如佛像、經書、唐卡、等,因為汙損或其他原因,不得已,必須銷毀,為恭敬故,欲焚毀前,可唸以下之咒語及偈子,並觀想佛菩薩自佛像中離開回到佛國土去。
I think the crux is to respectfully do the action and visualise the Buddhas and Bodhisattvas going back to their realm
This topic was re-visited by Venerable Ru Jun in a recent Q&A online discourse I attended.
Some pointers shared by fellow attendees:
When disposing the Buddhist objects or going into dirty places (e.g. toilets) with scriptures/relics, we can recite the 金剛力咒 in one of the following ways: