You could use Illustrator’s “Object Mosaic” function.
- Create your gradient.
The mosaic function only works on raster images so first select your gradient object and rasterize (Object → Rasterize…)
Then run the mosaic function (Object → Create Object Mosaic…)
- You can add a drop shadow effect (Effect → Stylize → Drop Shadow…) to specific tiles by selecting them with the Direct Selection Tool (you may need to bring them forward too; right-click “Arrange → Bring to Front”).