Use Clip Raster by Mask tool from the Toolbox and click on the green iterator to clip the raster image by each smaller boundary inside the shapefile:
Using the above tool with iterator enabled, here is the result:
I think you can find the answer on this link -
"The border value, which is currently black, may be set to NoData using the RasterBandNoDataSetter transformer with a noData value set to 0. This will result in the background becoming transparent. If done this way, ...
Yes, but it is a bit different but also very comfortable and easy. You have to open the processing toolbox and then choose "Edit feature in place". Then you have the tools to edit features depending on their type (point/line/polygon) like in ArcGis...but even more and better!
The result is correct. Since the extent of A is larger, the function is correctly cropping the extent of B. To get the same "shape", try something along the lines of:
mask(B, crop(B, extent(A)), A)
However, this will still show a smaller extent in B. If you really need the two rasters to show the same extent of data then you will likely have to coerce ...