Changed the return value of ApplyMaterial to be the shader's Apply function