I need to model an incline rectangle shape

nx=1001
nz=501
idepth=30

allocate(icode(1:nx,1:nz))	
do i=1,nx
	do j=1,nz
		if(j<=idepth)then
			icode(i,j)='1'
		elseif(j>idepth)then
			icode(i,j)='2'		
        endif
	enddo
enddo


 do i=1,nx
    do j=1,nz
        if(i<=525.and.i>=475.and.j<=14.and.j>=5)then
            icode(i,j)='3'
        endif
    enddo
enddo