This seems to work but the result is rather ugly...since there is no depth information.
The cube is not a solid object, That`s why I presume. And the shadow does not pick up the mask.
Could not get it to work with the Path Tracer at all right now.
CHeers, Klaus