Pharaoh's Hardened Heart and the Four Tefillin Passages

Yalkut Shimoni on Torah 225:5

"And it came to pass, when Pharaoh stubbornly refused" (Exodus 13:15). I might understand this to mean of his own accord; therefore the text teaches, "And the LORD hardened the heart of Pharaoh." "And the LORD slew every firstborn in the land of Egypt," and so on. From here the sages said: we sacrifice the firstborn of cattle corresponding to the firstborn of cattle [that died in Egypt], and we redeem the firstborn of man corresponding to the firstborn of man. "And it shall be for a sign upon your hand" (Exodus 13:16). In four places the passage of the tefillin is mentioned: "Sanctify to Me every firstborn," "And it shall be when the LORD brings you," "Hear, O Israel," and "And it shall be if you hearken." From here they said: the commandment of tefillin consists of four passages, which are the four compartments of the headpiece, and these are they: "Sanctify to Me every firstborn," "And it shall be when He brings you," "Hear," and "And it shall be if you hearken." One writes them in their proper order, and if one wrote them out of their order, they must be hidden away [as unfit for use].

Themes