Sorry, I know this is an old question, but I came across the answers and they seem to evade giving a direct answer to the question. While I agree other parameters become involved and thus, the answer isn't quite that simple, a simple answer could have been given followed by caveats and addendums, yet wasn't.
Answer: Effectively, you should go at least half way into the securing material.
caveats and addendums:
If the screw goes THROUGH the securing material, then the threads of the screw in most cases are not going to bite into the material and thus the screw isn't holding itself in place and will likely strip. In other words, the threads, and not the shank of a screw (if any), are what secure the screw into the securing material. OR, if the screw is too long and doesn't have any shank, then you are not using the minimum most effective screw; it will take too long to bottom out, the length of the screw which pierced the far side isn't doing anything, and thus is a waste of materials and effort.
If the screw only goes in one quarter of the way into the material, then the screw has not purchased enough threads into the hole to securely fasten in place. "it is only hanging on by a (couple of) thread(s)."
However, NOW the questions are, how thick does the securing material have to be, how much sheer weight or pull is the screw going to endure, what type of material is the screw being secured into, and what type of screw is being used ("the right tool for the job"), etc. The last being "is the screw all thread or does it have a shank?"
In the example(s) given, let's say the brick is a solid masonry brick; 3-1/2" deep x 2-1/4" high x 8" long brick. Going through 3/4" plywood, plus at least half the distance into the material, or a minimum of 1-3/4", then the screw should be 2-1/2" long.
However, if you are talking about a cinder block or any other brick type that has voids to reduce weight, then remember you don't want the screw piercing these voids for reasons I gave above. Also, you don't want a screw with a shank (if there is any) any longer than 3/4" (the thickness of the plywood).